<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    body {
      background-color: #4646c0;
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    button {
      position: relative;
      background-color: rgb(0, 174, 236);
      color: rgb(194, 230, 34);
      font-size: 14px;
      font-weight: 600;
      border-radius: 5px;
      text-transform: uppercase;
      letter-spacing: 2px;
      padding: 20px 30px;
      transition: all .3s;
      box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.3);
      overflow: hidden;
      border: none;
    }

    button:hover {
      box-shadow: 0 8px 8px -3px rgba(0, 0, 0, 0.3),
        4px 0px 8px -3px rgba(0, 0, 0, 0.3),
        -4px 0px 8px -3px rgba(0, 0, 0, 0.3);
      cursor: pointer;
    }

    .circle {
      position: absolute;
      width: 100px;
      height: 100px;
      background-color: #fff;
      border-radius: 50%;
      transform: translate(-50%, -50%) scale(0);
      animation: scacle 0.5s ease-out;
    }

    @keyframes scacle {
      from {
        transform: translate(-50%, -50%) scale(0);
        opacity: .5;
      }

      to {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
      }
    }
  </style>
</head>

<body>
  <button>
    Click me
  </button>
</body>
<script>
  const button = document.querySelector('button');
  button.addEventListener('click', (ev) => {
    let clientx = ev.clientX; //鼠标点的位置
    let clienty = ev.clientY;
    let left = clientx - ev.target.offsetLeft;
    let top = clienty - ev.target.offsetTop;
    let circle = document.createElement('span');
    circle.className = 'circle';
    circle.style.top = top + "px";
    circle.style.left = left + "px";
    button.appendChild(circle);
    setTimeout(() => {
      button.removeChild(circle);
    }, 500)
  });
</script>

</html>